﻿Imports System.Reflection
Public Class GridRowCount

    Public Sub New()

        ' 此调用是 Windows 窗体设计器所必需的。
        InitializeComponent()
        ' 在 InitializeComponent() 调用之后添加任何初始化。
    End Sub

    Private _ClassName As String = ""
    Public Property GridClassName() As String
        Get
            Return _ClassName
        End Get
        Set(ByVal value As String)
            _ClassName = value
        End Set
    End Property

    Private _初始行数 As Integer = 0
    Public Property 初始行数Grid() As Integer
        Get
            Return _初始行数
        End Get
        Set(ByVal value As Integer)
            _初始行数 = value
        End Set
    End Property

    Public Sub New(ByVal strFontName As String)
        InitializeComponent()
        GridClassName = strFontName
    End Sub

    Public ReadOnly Property GridRowCount() As String
        Get
            Return CStr(Me.NumericUpDown1.Value)
        End Get

    End Property

    Private Sub FontSetting_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Try
            Dim configFontName As Integer = 初始行数Grid
            Dim rs As ADODB.Recordset = ct.GetTable("select * from XSCFormData where CLASSNAME='" + Me.GridClassName + "'")
            If rs IsNot Nothing AndAlso rs.EOF = False Then
                If rs("GridRowCount").Value IsNot DBNull.Value Then
                    Dim strFontName = CInt(rs("GridRowCount").Value)
                    If strFontName <> 0 Then
                        configFontName = strFontName
                    End If
                End If
                rs.Close()
                System.Runtime.InteropServices.Marshal.ReleaseComObject(rs)
                rs = Nothing
            End If
            Me.NumericUpDown1.Value = configFontName
        Catch ex As Exception
            UTIL.CException.SaveExcepiton(UTIL.ErrorType.Error, ex, MethodBase.GetCurrentMethod.GetType())
        End Try

    End Sub

    Private Sub MyButton1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyButton1.Click
        Dim strSql As String = "Update XSCFormData set GridRowCount='" + CStr(Me.NumericUpDown1.Value) + "' where CLASSNAME='" + Me.GridClassName + "'"
        ct.ExecuteSql(strSql)
        ShowMessageBox("修改成功")
    End Sub
End Class
